#pragma once

#define print(x) \
do { \
  int size = sizeof(x); \
  if (size <= 4) { \
    __asm__("mov $0x3f8, %%dx\n\t" \
            "out %%eax, %%dx\n\t" \
            : \
            : "a"(x) /* Tell the C compiler to load x into the eax register */\
            : "dx"); /* Inline assembly breaks dx and tells the C compiler to save and recover dx register as needed */\
  } else if (size == 8) { \
    __asm__("mov $0x3f8, %%dx\n\t" \
            "out %%eax, %%dx\n\t" \
            "shr $32, %%rax\n\t" \
            "out %%eax, %%dx\n\t" \
            : \
            : "a"(x) \
            : "dx"); \
  } \
} while (0)
